package com.glp.work.flow.contract.builder;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

public class Table implements Serializable, Cloneable {

  private static final long serialVersionUID = -7267714081669547116L;

  private Integer width;
  private String fontFamily;
  private Integer fontSize;
  private String color;
  private Boolean bold;
  private Boolean italic;

  private Part header;
  private Part body;
  private Part footer;
  
  @Override
  public Table clone() {
    Table table = new Table();
    table.width = this.width;
    table.fontFamily = this.fontFamily;
    table.fontSize = this.fontSize;
    table.color = this.color;
    table.bold = this.bold;
    table.italic = this.italic;
    if(header != null) {
      table.header = header.clone();
    }
    if(body != null) {
      table.body = body.clone();
    }
    if(footer != null) {
      table.footer = footer.clone();
    }
    return table;
  }
  
  public static class Part implements Cloneable {

    private Integer height;
    private String fontFamily;
    private Integer fontSize;
    private String color;
    private Boolean bold;
    private Boolean italic;
    private String key;
    
    private List<Cell> cells;

    @Override
    public Part clone() {
      Part part = new Part();
      part.height = this.height;
      part.fontFamily = this.fontFamily;
      part.fontSize = this.fontSize;
      part.color = this.color;
      part.bold = this.bold;
      part.italic = this.italic;
      part.key = this.key;
      List<Cell> list = new ArrayList<Cell>(cells.size());
      for(Cell cell : cells) {
        list.add(cell.clone());
      }
      part.cells = list;
      return part;
    }
    
    public Integer getHeight() {
      return height;
    }

    public void setHeight(Integer height) {
      this.height = height;
    }

    public String getFontFamily() {
      return fontFamily;
    }

    public void setFontFamily(String fontFamily) {
      this.fontFamily = fontFamily;
    }

    public Integer getFontSize() {
      return fontSize;
    }

    public void setFontSize(Integer fontSize) {
      this.fontSize = fontSize;
    }

    public String getColor() {
      return color;
    }

    public void setColor(String color) {
      this.color = color;
    }

    public Boolean getBold() {
      return bold;
    }

    public void setBold(Boolean bold) {
      this.bold = bold;
    }

    public Boolean getItalic() {
      return italic;
    }

    public void setItalic(Boolean italic) {
      this.italic = italic;
    }

    public String getKey() {
      return key;
    }

    public void setKey(String key) {
      this.key = key;
    }

    public List<Cell> getCells() {
      return cells;
    }

    public void setCells(List<Cell> cells) {
      this.cells = cells;
    }

  }

  public static class Cell implements Cloneable {

    private Integer width = 1;
    private String fontFamily;
    private Integer fontSize;
    private String color;
    private Boolean bold;
    private Boolean italic;
    private String evl;
    private Object value;

    @Override
    public Cell clone() {
      Cell cell = new Cell();
      cell.width = this.width;
      cell.fontFamily = this.fontFamily;
      cell.fontSize = this.fontSize;
      cell.color = this.color;
      cell.bold = this.bold;
      cell.italic = this.italic;
      cell.evl = this.evl;
      cell.value = this.value;
      return cell;
    }
    
    public Integer getWidth() {
      return width;
    }

    public void setWidth(Integer width) {
      this.width = width;
    }

    public String getFontFamily() {
      return fontFamily;
    }

    public void setFontFamily(String fontFamily) {
      this.fontFamily = fontFamily;
    }

    public Integer getFontSize() {
      return fontSize;
    }

    public void setFontSize(Integer fontSize) {
      this.fontSize = fontSize;
    }

    public String getColor() {
      return color;
    }

    public void setColor(String color) {
      this.color = color;
    }

    public Boolean getBold() {
      return bold;
    }

    public void setBold(Boolean bold) {
      this.bold = bold;
    }

    public Boolean getItalic() {
      return italic;
    }

    public void setItalic(Boolean italic) {
      this.italic = italic;
    }

    public String getEvl() {
      return evl;
    }

    public void setEvl(String evl) {
      this.evl = evl;
    }

    public Object getValue() {
      return value;
    }

    public void setValue(Object value) {
      this.value = value;
    }

  }

  public Integer getWidth() {
    return width;
  }

  public void setWidth(Integer width) {
    this.width = width;
  }

  public String getFontFamily() {
    return fontFamily;
  }

  public void setFontFamily(String fontFamily) {
    this.fontFamily = fontFamily;
  }

  public Integer getFontSize() {
    return fontSize;
  }

  public void setFontSize(Integer fontSize) {
    this.fontSize = fontSize;
  }

  public String getColor() {
    return color;
  }

  public void setColor(String color) {
    this.color = color;
  }

  public Boolean getBold() {
    return bold;
  }

  public void setBold(Boolean bold) {
    this.bold = bold;
  }

  public Boolean getItalic() {
    return italic;
  }

  public void setItalic(Boolean italic) {
    this.italic = italic;
  }

  public Part getHeader() {
    return header;
  }

  public void setHeader(Part header) {
    this.header = header;
  }

  public Part getBody() {
    return body;
  }

  public void setBody(Part body) {
    this.body = body;
  }

  public Part getFooter() {
    return footer;
  }

  public void setFooter(Part footer) {
    this.footer = footer;
  }
  
}
